import VueRouter from 'vue-router'

//2.导入路由组件
import TIndex from '../components/tabbars/index.vue'
import HomeContainer from '../components/tabbars/HomeContainer.vue'
import MemberContainer from '../components/tabbars/MemberContainer.vue'
import ShopcarContainer from '../components/tabbars/ShopcarContainer.vue'
import SearchContainer from '../components/tabbars/SearchContainer.vue'
import NewsList from '../components/news/NewsList.vue'
import NewsInfo from '../components/news/NewsInfo.vue'
import PhotoList from '../components/photos/PhotoList.vue'
import PhotoInfo from '../components/photos/PhotoInfo.vue'
import ShopList from '../components/shops/ShopList.vue'
import GoodsInfo from '../components/shops/GoodsInfo.vue'
import GoodsDesc from '../components/shops/GoodsDesc.vue'
import GoodsComment from '../components/shops/GoodsComment.vue'
//3.创建路由对象 
const router = new VueRouter({
    routes:[
        {
            path:'/',
            redirect:'/idssp'
        },//默认页面一打开就显示登录界面
        {
            path: "/login",
            name: "login",
            component: () => import("../components/Login.vue"),
            meta: {
                title: '登录',
            }
        },
        {
            path: "/register",
            name: "register",
            component: () => import("../components/Register.vue"),
            meta: {
                title: '注册',
            }
        },
        {
            path: "/changeWord",
            name: "changeWord",
            component: () => import("../components/ChangeWord.vue"),
            meta: {
                title: '找回密码',
            }
        },
        {
            path:'/idssp',
            name:'idssPlatform',
            component: TIndex,
            redirect:'/idssp/home',
            children:[
                {
                    path:'home',
                    component:HomeContainer,
                    meta: {
                        title: '首页',
                        keepAlive: true,
                    }
                },
                {
                    path:'shopcar',
                    component:ShopcarContainer,
                    meta: {
                        title: '购物车',
                        keepAlive: true,
                    }
                },
                {
                    path:'member',
                    component:MemberContainer,
                    meta: {
                        title: '个人中心',
                        keepAlive: true,
                    }
                },
            ]
        },
        // {
        //     path:'/search',
        //     component:SearchContainer,
        //     meta: {
        //         title: '搜索',
        //         keepAlive: true,
        //     }
        // },
        {
            path:'/idssp/news',
            name:'news',
            component: ()=>import('../components/news/index.vue'),
            redirect:'/idssp/news/newslist',
            children:[
                {
                    path:'newslist',
                    component:NewsList,
                    meta: {
                        title: '新闻资讯',
                        keepAlive: true,
                    }
                },
                // 注意这里的 ：id
                {
                    path:'newsinfo/:id',
                    component:NewsInfo,
                    props:true,
                    meta: {
                        title: '新闻详情',
                        keepAlive: true,
                    }
                },//启用props接受路由的参数
            ]
        },
        {
            path:'/idssp/photos',
            name:'photos',
            component: ()=>import('../components/photos/index.vue'),
            redirect:'/idssp/photos/photolist',
            children:[
                {
                    path:'photolist',
                    component:PhotoList,
                    meta: {
                        title: '图片分享',
                        keepAlive: true,
                    }
                },
                {
                    path:'photoinfo/:id',
                    component:PhotoInfo,
                    props:true,
                    meta: {
                        title: '图片详情',
                        keepAlive: true,
                    }
                },
            ]
        },
        {
            path:'/idssp/shops',
            name:'shops',
            component: ()=>import('../components/shops/index.vue'),
            redirect:'/idssp/shops/shoplist',
            children:[
                {
                    path:'shoplist',
                    component:ShopList,
                    meta: {
                        title: '商品购买',
                        keepAlive: true,
                    }
                },
                {
                    path:'goodsinfo/:id',
                    component:GoodsInfo,
                    props:true,
                    meta: {
                        title: '商品详情',
                        keepAlive: true,
                    }
                },
                {
                    path:'goodsdesc/:id',
                    component:GoodsDesc,
                    props:true,
                    meta: {
                        title: '图文介绍',
                        keepAlive: true,
                    }
                },
                {
                    path:'goodscomment/:id',
                    name:"goodscmt",
                    component:GoodsComment,
                    props:true,
                    meta: {
                        title: '商品评论',
                        keepAlive: true,
                    }
                },
            ]
        },
        {
            path:'/idssp/member/myinfo',
            name:'myInfo',
            component: ()=>import('../components/memberSub/MyInfo.vue'),
            props:true,
            meta: {
                title: '个人主页',
                keepAlive: true,
            }
        },
        {
            path:'/idssp/member/myLike',
            name:'myLike',
            component: ()=>import('../components/memberSub/MyLike.vue'),
            meta: {
                title: '我的喜欢',
                keepAlive: true,
            }
        },
        {
            path:'/idssp/member/myComment',
            name:'myComment',
            component: ()=>import('../components/memberSub/MyComment.vue'),
            meta: {
                title: '我的评论',
                keepAlive: true,
            }
        },
        {
            path:'/idssp/member/message',
            name:'message',
            component: ()=>import('../components/memberSub/Message.vue'),
            meta: {
                title: '消息通知',
                keepAlive: true,
            }
        },
        {
            path:'/idssp/member/connect',
            name:'connect',
            component: ()=>import('../components/memberSub/Connect.vue'),
            meta: {
                title: '联系我们',
                keepAlive: true,
            }
        },
        {
            path:'/idssp/order/confirmOrder',
            name:'confirmOrder',
            component: ()=>import('../components/order/ConfirmOrder.vue'),
            meta: {
                title: '确认订单',
                keepAlive: true,
            }
        },
        {
            path:'/idssp/order/myAdress',
            name:'myAdress',
            component: ()=>import('../components/order/MyAdress.vue'),
            meta: {
                title: '我的收货地址',
                keepAlive: true,
            }
        },
        {
            path:'/idssp/order/editorAdress',
            name:'editorAdress',
            component: ()=>import('../components/order/EditorAdress.vue'),
            meta: {
                title: '编辑收货地址',
                keepAlive: true,
            }
        },
        {
            path:'/idssp/order/addAdress',
            name:'addAdress',
            component: ()=>import('../components/order/AddAdress.vue'),
            meta: {
                title: '添加收货地址',
                keepAlive: true,
            }
        },
        {
            path:'/idssp/order/paySuccess',
            name:'paySuccess',
            component: ()=>import('../components/order/PaySuccess.vue'),
            meta: {
                title: '支付',
                keepAlive: true,
            }
        },
        {
            path:'/idssp/order/myOrder',
            name:'myOrder',
            component: ()=>import('../components/order/MyOrder.vue'),
            meta: {
                title: '我的订单',
                keepAlive: true,
            }
        },
    ],
    linkActiveClass:'mui-active' //手动设置 被激活的 路由链接的高亮类名
})

// 4.导出路由对象
export default router